home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / debugger / ddd-1.000 / ddd-1 / ddd-1.4b / configure < prev    next >
Encoding:
Text File  |  1996-01-12  |  33.7 KB  |  1,068 lines

  1. #!/bin/sh
  2.  
  3. ### WARNING: this file contains embedded tabs.  Do not run untabify on this file.
  4.  
  5. # Configuration script
  6. # Copyright (C) 1988, 90, 91, 92, 93, 94 Free Software Foundation, Inc.
  7.  
  8. # This program is free software; you can redistribute it and/or modify
  9. # it under the terms of the GNU General Public License as published by
  10. # the Free Software Foundation; either version 2 of the License, or
  11. # (at your option) any later version.
  12. # This program is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. # GNU General Public License for more details.
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, write to the Free Software
  18. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  19.  
  20. # Please report any problems running this configure script to
  21. # configure@cygnus.com
  22. # Please do not send reports about other problems to this address.  See
  23. # gdb/README, gas/README, etc., for info on where and how to report
  24. # problems about particular tools.
  25.  
  26. # This file was written by K. Richard Pixley.
  27.  
  28. #
  29. # Shell script to create proper links to machine-dependent files in
  30. # preparation for compilation.
  31. #
  32. # If configure succeeds, it leaves its status in config.status.
  33. # If configure fails after disturbing the status quo, 
  34. #       config.status is removed.
  35. #
  36.  
  37. export PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh $0 $argv; kill $$)
  38.  
  39. remove=rm
  40. hard_link=ln
  41. symbolic_link='ln -s'
  42.  
  43. #for Test
  44. #remove="echo rm"
  45. #hard_link="echo ln"
  46. #symbolic_link="echo ln -s"
  47.  
  48. # clear some things potentially inherited from environment.
  49.  
  50. Makefile=Makefile
  51. Makefile_in=Makefile.in
  52. arguments=$*
  53. build_alias=
  54. cache_file=
  55. cache_file_option=
  56. configdirs=
  57. exec_prefix=
  58. exec_prefixoption=
  59. fatal=
  60. floating_point=default
  61. gas=default
  62. host_alias=NOHOST
  63. host_makefile_frag=
  64. moveifchange=
  65. norecursion=
  66. other_options=
  67. package_makefile_frag=
  68. prefix=/usr/local
  69. progname=
  70. program_prefix=
  71. program_prefixoption=
  72. program_suffix=
  73. program_suffixoption=
  74. program_transform_name=
  75. program_transform_nameoption=
  76. redirect=">/dev/null"
  77. removing=
  78. site=
  79. site_makefile_frag=
  80. site_option=
  81. srcdir=
  82. srctrigger=
  83. subdirs=
  84. target_alias=NOTARGET
  85. target_makefile_frag=
  86. undefs=NOUNDEFS
  87. version="$Revision: 1.4 $"
  88. x11=default
  89.  
  90. ### we might need to use some other shell than /bin/sh for running subshells
  91. #
  92. config_shell=${CONFIG_SHELL-/bin/sh}
  93.  
  94. NO_EDIT="This file was generated automatically by configure.  Do not edit."
  95.  
  96. ## this is a little touchy and won't always work, but...
  97. ##
  98. ## if the argv[0] starts with a slash then it is an absolute name that can (and
  99. ## must) be used as is.
  100. ##
  101. ## otherwise, if argv[0] has no slash in it, we can assume that it is on the
  102. ## path.  Since PATH might include "." we also add `pwd` to the end of PATH.
  103. ##
  104.  
  105. progname=$0
  106. # if PWD already has a value, it is probably wrong.
  107. if [ -n "$PWD" ]; then PWD=`pwd`; fi
  108.  
  109. case "${progname}" in
  110. /*) ;;
  111. */*) ;;
  112. *)
  113.         PATH=$PATH:${PWD=`pwd`} ; export PATH
  114.         ;;
  115. esac
  116.  
  117. # Loop over all args
  118.  
  119. while :
  120. do
  121.  
  122. # Break out if there are no more args
  123.     case $# in
  124.     0)
  125.         break
  126.         ;;
  127.     esac
  128.  
  129. # Get the first arg, and shuffle
  130.     option=$1
  131.     shift
  132.  
  133. # Make all options have two hyphens
  134.     orig_option=$option    # Save original for error messages
  135.     case $option in
  136.     --*) ;;
  137.     -*) option=-$option ;;
  138.     esac
  139.         
  140. # Split out the argument for options that take them
  141.     case $option in
  142.     --*=*)
  143.         optarg=`echo $option | sed -e 's/^[^=]*=//'`
  144.         ;;
  145. # These options have mandatory values.  Since we didn't find an = sign,
  146. # the value must be in the next argument
  147.     --b* | --cache* | --ex* | --ho* | --pre* | --program-p* | --program-s* | --program-t* | --si* | --sr* | --ta* | --tm* | --x-*)
  148.         optarg=$1
  149.         shift
  150.         ;;
  151.     esac
  152.  
  153. # Now, process the options
  154.     case $option in
  155.  
  156.     --build* | --b*)
  157.         case "$build_alias" in
  158.         "") build_alias=$optarg ;;
  159.         *) echo '***' Can only configure for one build machine at a time.  1>&2
  160.            fatal=yes
  161.            ;;
  162.         esac
  163.         ;;
  164.     --cache*)
  165.         cache_file=$optarg
  166.         ;;
  167.     --disable-*)
  168.         enableopt=`echo ${option} | sed 's:^--disable-:enable_:;s:-:_:g'`
  169.         eval $enableopt=no
  170.         disableoptions="$disableoptions $option"
  171.         ;;
  172.     --enable-*)
  173.         case "$option" in
  174.         *=*)    ;;
  175.         *)    optarg=yes ;;
  176.         esac
  177.  
  178.         enableopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
  179.         eval $enableopt="$optarg"
  180.         enableoptions="$enableoptions $option"
  181.         ;;
  182.     --exec-prefix* | --ex*)
  183.         exec_prefix=$optarg
  184.         exec_prefixoption="--exec-prefix=$optarg"
  185.         ;;
  186.     --gas | --g*)
  187.         gas=yes
  188.         ;;
  189.     --help | --he*)
  190.         fatal=yes
  191.         ;;
  192.     --host* | --ho*)
  193.         case $host_alias in
  194.         NOHOST) host_alias=$optarg ;;
  195.         *) echo '***' Can only configure for one host at a time.  1>&2
  196.            fatal=yes
  197.            ;;
  198.         esac
  199.         ;;
  200.     --nfp | --nf*)
  201.         floating_point=no
  202.         ;;
  203.     --norecursion | --no*)
  204.         norecursion=yes
  205.         ;;
  206.     --prefix* | --pre*)
  207.         prefix=$optarg
  208.         prefixoption="--prefix=$optarg"
  209.         ;;
  210.     --program-prefix* | --program-p*)
  211.         program_prefix=$optarg
  212.         program_prefixoption="--program-prefix=$optarg"
  213.         ;;
  214.     --program-suffix* | --program-s*)
  215.         program_suffix=$optarg
  216.         program_suffixoption="--program-suffix=$optarg"
  217.         ;;
  218.     --program-transform-name* | --program-t*)
  219.         # Double any backslashes or dollar signs in the argument
  220.         program_transform_name="${program_transform_name} -e `echo ${optarg} | sed -e 's/\\\\/\\\\\\\\/g' -e 's/\\\$/$$/g'`"
  221.         program_transform_nameoption="${program_transform_nameoption} --program-transform-name='$optarg'"
  222.         ;;
  223.     --rm)
  224.         removing=--rm
  225.         ;;
  226.     --silent | --sil* | --quiet | --q*)
  227.         redirect=">/dev/null"
  228.         verbose=--silent
  229.         ;;
  230.     --site* | --sit*)
  231.         site=$optarg
  232.         site_option="--site=$optarg"
  233.         ;;
  234.     --srcdir*/ | --sr*/)
  235.                 # Remove trailing slashes.  Otherwise, when the file name gets
  236.                 # bolted into an object file as debug info, it has two slashes
  237.                 # in it.  Ordinarily this is ok, but emacs takes double slash
  238.                 # to mean "forget the first part".
  239.         srcdir=`echo $optarg | sed -e 's:/$::'`
  240.         ;;
  241.     --srcdir* | --sr*)
  242.         srcdir=$optarg
  243.         ;;
  244.     --target* | --ta*)
  245.         case $target_alias in
  246.         NOTARGET) target_alias=$optarg ;;
  247.         *) echo '***' Can only configure for one target at a time.  1>&2
  248.            fatal=yes
  249.            ;;
  250.         esac
  251.         ;;
  252.     --tmpdir* | --tm*)
  253.         TMPDIR=$optarg
  254.         tmpdiroption="--tmpdir=$optarg"
  255.         ;;
  256.     --verbose | --v | --verb*)
  257.         redirect=
  258.         verbose=--verbose
  259.         ;;
  260.     --version | --V | --vers*)
  261.         echo "This is Cygnus Configure version" `echo ${version} | sed 's/[ $:]//g'`
  262.         exit 0
  263.         ;;
  264.     --with-*)
  265.         case "$option" in
  266.         *=*)    ;;
  267.         *)    optarg=yes ;;
  268.         esac
  269.  
  270.         withopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
  271.         eval $withopt="$optarg"
  272.         withoptions="$withoptions $option"
  273.         ;;
  274.     --without-*)
  275.         withopt=`echo ${option} | sed 's:^--::;s:out::;s:-:_:g'`
  276.         eval $withopt=no
  277.         withoutoptions="$withoutoptions $option"
  278.         ;;
  279.     --x)    with_x=yes
  280.         withoptions="$withoptions --with-x"
  281.         ;;
  282.     --x-i* | --x-l*) other_options="$other_options $orig_option"
  283.         ;;
  284.     --*)
  285.         echo "configure: Unrecognized option: \"$orig_option\"; use --help for usage." >&2
  286.         exit 1
  287.         ;;
  288.     *)
  289.         case $undefs in
  290.         NOUNDEFS) undefs=$option ;;
  291.         *) echo '***' Can only configure for one host and one target at a time.  1>&2
  292.            fatal=yes
  293.            ;;
  294.         esac
  295.         ;;
  296.     esac
  297. done
  298.  
  299. # process host and target
  300.  
  301. # Do some error checking and defaulting for the host and target type.
  302. # The inputs are:
  303. #    configure --host=HOST --target=TARGET UNDEFS
  304. #
  305. # The rules are:
  306. # 1. You aren't allowed to specify --host, --target, and undefs at the
  307. #    same time.
  308. # 2. Host defaults to undefs.
  309. # 3. If undefs is not specified, then host defaults to the current host,
  310. #    as determined by config.guess.
  311. # 4. Target defaults to undefs.
  312. # 5. If undefs is not specified, then target defaults to host.
  313.  
  314. case "${fatal}" in
  315. "")
  316.     # Make sure that host, target & undefs aren't all specified at the
  317.     # same time.
  318.     case $host_alias---$target_alias---$undefs in
  319.     NOHOST---*---* | *---NOTARGET---* | *---*---NOUNDEFS)
  320.         ;;
  321.     *) echo '***' Can only configure for one host and one target at a time.  1>&2
  322.        fatal=yes
  323.        break 2
  324.         ;;
  325.     esac
  326.  
  327.     # Now, do defaulting for host.
  328.     case $host_alias in
  329.     NOHOST)
  330.         case $undefs in
  331.         NOUNDEFS)
  332.             # Neither --host option nor undefs were present.
  333.             # Call config.guess.
  334.             guesssys=`echo ${progname} | sed 's/configure$/config.guess/'`
  335.             if host_alias=`${guesssys}`
  336.             then
  337.                 # If the string we are going to use for
  338.                 # the target is a prefix of the string
  339.                 # we just guessed for the host, then
  340.                 # assume we are running native, and force
  341.                 # the same string for both target and host.
  342.                 case $target_alias in
  343.                 NOTARGET) ;;
  344.                 *)
  345.                     if expr $host_alias : $target_alias >/dev/null
  346.                     then
  347.                         host_alias=$target_alias
  348.                     fi
  349.                     ;;
  350.                 esac
  351.                 echo "Configuring for a ${host_alias} host." 1>&2
  352.                 arguments="--host=$host_alias $arguments"
  353.             else
  354.                 echo 'Config.guess failed to determine the host type.  You need to specify one.' 1>&2
  355.                 fatal=yes
  356.             fi
  357.             ;;
  358.         *)
  359.             host_alias=$undefs
  360.             ;;
  361.         esac
  362.     esac
  363.  
  364.     # Do defaulting for target.  If --target option isn't present, default
  365.     # to undefs.  If undefs isn't present, default to host.
  366.     case $target_alias in
  367.     NOTARGET)
  368.         case $undefs in
  369.         NOUNDEFS)
  370.             target_alias=$host_alias
  371.             ;;
  372.         *)
  373.             target_alias=$undefs
  374.             ;;
  375.         esac
  376.     esac
  377.     ;;
  378. *) ;;
  379. esac
  380.  
  381. if [ -n "${fatal}" -o "${host_alias}" = "help" ] ; then
  382.     exec 1>&2
  383.     echo Usage: configure [OPTIONS] [HOST]
  384.     echo
  385.     echo Options: [defaults in brackets]
  386.     echo ' --prefix=MYDIR         install into MYDIR [/usr/local]'
  387.     echo ' --exec-prefix=MYDIR     install host-dependent files into MYDIR [/usr/local]'
  388.     echo ' --help             print this message [normal config]'
  389.     echo ' --build=BUILD         configure for building on BUILD [BUILD=HOST]'
  390.     echo ' --host=HOST         configure for HOST [determined via config.guess]'
  391.     echo ' --norecursion         configure this directory only [recurse]'
  392.     echo ' --program-prefix=FOO     prepend FOO to installed program names [""]'
  393.     echo ' --program-suffix=FOO     append FOO to installed program names [""]'
  394.     echo ' --program-transform-name=P transform installed names by sed pattern P [""]'
  395.     echo ' --site=SITE         configure with site-specific makefile for SITE'
  396.     echo ' --srcdir=DIR         find the sources in DIR [. or ..]'
  397.     echo ' --target=TARGET     configure for TARGET [TARGET=HOST]'
  398.     echo ' --tmpdir=TMPDIR     create temporary files in TMPDIR [/tmp]'
  399.     echo ' --nfp             configure for software floating point [hard float]'
  400.     echo ' --with-FOO, --with-FOO=BAR package FOO is available (parameter BAR)'
  401.     echo ' --without-FOO         package FOO is NOT available'
  402.     echo ' --enable-FOO, --enable-FOO=BAR include feature FOO (parameter BAR)'
  403.     echo ' --disable-FOO         do not include feature FOO'
  404.     echo
  405.     echo 'Where HOST and TARGET are something like "sparc-sunos", "mips-sgi-irix5", etc.'
  406.     echo
  407.     if [ -r config.status ] ; then
  408.         cat config.status
  409.     fi
  410.  
  411.     exit 1
  412. fi
  413.  
  414. configsub=`echo ${progname} | sed 's/configure$/config.sub/'`
  415. moveifchange=`echo ${progname} | sed 's/configure$/move-if-change/'`
  416.  
  417. # this is a hack.  sun4 must always be a valid host alias or this will fail.
  418. if ${configsub} sun4 >/dev/null 2>&1 ; then
  419.         true
  420. else
  421.         echo '***' cannot find config.sub.  1>&2
  422.         exit 1
  423. fi
  424.  
  425. touch config.junk
  426. if ${moveifchange} config.junk config.trash ; then
  427.         true
  428. else
  429.         echo '***' cannot find move-if-change.  1>&2
  430.         exit 1
  431. fi
  432. rm -f config.junk config.trash
  433.  
  434. case "${srcdir}" in
  435. "")
  436.         if [ -r configure.in ] ; then
  437.                 srcdir=.
  438.         else
  439.                 if [ -r ${progname}.in ] ; then
  440.                         srcdir=`echo ${progname} | sed 's:/configure$::'`
  441.                 else
  442.                         echo '***' "Can't find configure.in.  Try using --srcdir=some_dir"  1>&2
  443.                         exit 1
  444.                 fi
  445.         fi
  446.         ;;
  447. *) ;;
  448. esac
  449.  
  450. ### warn about some conflicting configurations.
  451.  
  452. case "${srcdir}" in
  453. ".") ;;
  454. *)
  455.         if [ -f ${srcdir}/config.status ] ; then
  456.                 echo '***' Cannot configure here in \"${PWD=`pwd`}\" when \"${srcdir}\" is currently configured. 1>&2
  457.                 exit 1
  458.         fi
  459. esac
  460.  
  461. # default exec_prefix
  462. case "${exec_prefixoption}" in
  463. "") exec_prefix="\$(prefix)" ;;
  464. *) ;;
  465. esac
  466.  
  467. ### break up ${srcdir}/configure.in.
  468. case "`grep '^# per\-host:' ${srcdir}/configure.in`" in
  469. "")
  470.         echo '***' ${srcdir}/configure.in has no \"per-host:\" line. 1>&2
  471.     # Check for a directory that's been converted to use autoconf since
  472.     # it was last configured.
  473.     if grep AC_OUTPUT ${srcdir}/configure.in >/dev/null ; then
  474.       echo '***' Hmm, looks like this directory has been autoconfiscated. 1>&2
  475.       if [ -r ${srcdir}/configure ] ; then
  476.         echo '***' Running the local configure script. 1>&2
  477.         case "${cache_file}" in
  478.         "") cache_file_option= ;;
  479.         *)  cache_file_option="--cache-file=${cache_file}" ;;
  480.         esac
  481.         srcdiroption="--srcdir=${srcdir}"
  482.         case "${build_alias}" in
  483.         "") buildopt= ;;
  484.         *)  buildopt="--build=${build_alias}" ;;
  485.         esac
  486.         eval exec ${config_shell} ${srcdir}/configure ${verbose} \
  487.         ${buildopt} --host=${host_alias} --target=${target_alias} \
  488.         ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
  489.         ${srcdiroption} \
  490.         ${program_prefixoption} ${program_suffixoption} \
  491.         ${program_transform_nameoption} ${site_option} \
  492.         ${withoptions} ${withoutoptions} \
  493.         ${enableoptions} ${disableoptions} \
  494.         ${cache_file_option} ${removing} ${other_options} ${redirect}
  495.       else
  496.         echo '***' There is no configure script present though. 1>&2
  497.       fi
  498.     fi
  499.         exit 1
  500.         ;;
  501. *) ;;
  502. esac
  503.  
  504. case "`grep '^# per\-target:' ${srcdir}/configure.in`" in
  505. "")
  506.         echo '***' ${srcdir}/configure.in has no \"per-target:\" line. 1>&2
  507.         exit 1
  508.         ;;
  509. *) ;;
  510. esac
  511.  
  512. case "${TMPDIR}" in
  513. "") TMPDIR=/tmp ; export TMPDIR ;;
  514. *) ;;
  515. esac
  516.  
  517. # keep this filename short for &%*%$*# 14 char file names
  518. tmpfile=${TMPDIR}/cONf$$
  519. # Note that under many versions of sh a trap handler for 0 will *override* any
  520. # exit status you explicitly specify!  At this point, the only non-error exit
  521. # is at the end of the script; these actions are duplicated there, minus
  522. # the "exit 1".  Don't use "exit 0" anywhere after this without resetting the
  523. # trap handler, or you'll lose.
  524. trap "rm -f ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos; exit 1" 0 1 2 15
  525.  
  526. # split ${srcdir}/configure.in into common, per-host, per-target,
  527. # and post-target parts.  Post-target is optional.
  528. sed -e '/^# per\-host:/,$d' ${srcdir}/configure.in > ${tmpfile}.com
  529. sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.hst
  530. if grep '^# post-target:' ${srcdir}/configure.in >/dev/null ; then
  531.   sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.tgt
  532.   sed -e '1,/^# post\-target:/d' ${srcdir}/configure.in > ${tmpfile}.pos
  533. else
  534.   sed -e '1,/^# per\-target:/d' ${srcdir}/configure.in > ${tmpfile}.tgt
  535.   echo >${tmpfile}.pos
  536. fi
  537.  
  538. ### do common part of configure.in
  539.  
  540. . ${tmpfile}.com
  541.  
  542. # some sanity checks on configure.in
  543. case "${srctrigger}" in
  544. "")
  545.         echo '***' srctrigger not set in ${PWD=`pwd`}/configure.in.  1>&2
  546.         exit 1
  547.         ;;
  548. *) ;;
  549. esac
  550.  
  551. case "${build_alias}" in
  552. "")
  553.     if result=`${config_shell} ${configsub} ${host_alias}` ; then
  554.         build_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
  555.         build_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
  556.         build_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
  557.         build=${host_cpu}-${host_vendor}-${host_os}
  558.         build_alias=${host_alias}
  559.     fi
  560.     ;;
  561. *)
  562.     if result=`${config_shell} ${configsub} ${build_alias}` ; then
  563.         buildopt="--build=${build_alias}"
  564.         build_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
  565.         build_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
  566.         build_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
  567.         build=${build_cpu}-${build_vendor}-${build_os}
  568.     else
  569.         echo "Unrecognized build system name ${build_alias}." 1>&2
  570.         exit 1
  571.     fi
  572.     ;;
  573. esac
  574.  
  575. if result=`${config_shell} ${configsub} ${host_alias}` ; then
  576.     true
  577. else
  578.     echo "Unrecognized host system name ${host_alias}." 1>&2
  579.     exit 1
  580. fi
  581. host_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
  582. host_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
  583. host_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
  584. host=${host_cpu}-${host_vendor}-${host_os}
  585.  
  586. . ${tmpfile}.hst
  587.  
  588. if result=`${config_shell} ${configsub} ${target_alias}` ; then
  589.     true
  590. else
  591.     echo "Unrecognized target system name ${target_alias}." 1>&2
  592.     exit 1
  593. fi
  594. target_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
  595. target_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
  596. target_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
  597. target=${target_cpu}-${target_vendor}-${target_os}
  598.  
  599. . ${tmpfile}.tgt
  600.  
  601. # Find the source files, if location was not specified.
  602. case "${srcdir}" in
  603. "")
  604.         srcdirdefaulted=1
  605.         srcdir=.
  606.         if [ ! -r ${srctrigger} ] ; then
  607.                 srcdir=..
  608.         fi
  609.         ;;
  610. *) ;;
  611. esac
  612.  
  613. if [ ! -r ${srcdir}/${srctrigger} ] ; then
  614.         case "${srcdirdefaulted}" in
  615.         "") echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/${srcdir}" 1>&2 ;;
  616.         *)  echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/. or ${PWD=`pwd`}/.." 1>&2 ;;
  617.         esac
  618.  
  619.         echo '***' \(At least ${srctrigger} is missing.\) 1>&2
  620.         exit 1
  621. fi
  622.  
  623. # Some systems (e.g., one of the i386-aix systems the gas testers are
  624. # using) don't handle "\$" correctly, so don't use it here.
  625. tooldir='$(exec_prefix)'/${target_alias}
  626.  
  627. if [ "${host_alias}" != "${target_alias}" ] ; then
  628.     if [ "${program_prefixoption}" = "" ] ; then
  629.         if [ "${program_suffixoption}" = "" ] ; then 
  630.             if [ "${program_transform_nameoption}" = "" ] ; then
  631.                 program_prefix=${target_alias}- ;
  632.             fi
  633.         fi
  634.     fi
  635. fi
  636.  
  637. # Merge program_prefix and program_suffix onto program_transform_name.
  638. # (program_suffix used to use $, but it's hard to preserve $ through both
  639. # make and sh.)
  640. if [ "${program_suffix}" != "" ] ; then
  641.     program_transform_name="-e s,\\\\(.*\\\\),\\\\1${program_suffix}, ${program_transform_name}"
  642. fi
  643.  
  644. if [ "${program_prefix}" != "" ] ; then
  645.     program_transform_name="-e s,^,${program_prefix}, ${program_transform_name}"
  646. fi
  647.  
  648. for subdir in . ${subdirs} ; do
  649.  
  650.     # ${subdir} is relative path from . to the directory we're currently
  651.     # configuring.
  652.     # ${invsubdir} is inverse of ${subdir), *with* trailing /, if needed.
  653.     invsubdir=`echo ${subdir}/ | sed -e 's|\./||g' -e 's|[^/]*/|../|g'`
  654.  
  655.     ### figure out what to do with srcdir
  656.     case "${srcdir}" in
  657.         ".")  # no -srcdir option.  We're building in place.
  658.                 makesrcdir=. ;;
  659.         /*) # absolute path
  660.                 makesrcdir=`echo ${srcdir}/${subdir} | sed -e 's|/\.$||'`
  661.                 ;;
  662.         *) # otherwise relative
  663.                 case "${subdir}" in
  664.                 .) makesrcdir=${srcdir} ;;
  665.                 *) makesrcdir=${invsubdir}${srcdir}/${subdir} ;;
  666.                 esac
  667.                 ;;
  668.     esac
  669.  
  670.     if [ "${subdir}/" != "./" ] ; then
  671.         Makefile=${subdir}/Makefile
  672.     fi
  673.  
  674.     if [ ! -d ${subdir} ] ; then
  675.         if mkdir ${subdir} ; then
  676.                 true
  677.         else
  678.                 echo '***' "${progname}: could not make ${PWD=`pwd`}/${subdir}" 1>&2
  679.                 exit 1
  680.         fi
  681.     fi
  682.  
  683.     case "${removing}" in
  684.     "")
  685.         case "${subdir}" in
  686.         .) ;;
  687.         *) eval echo Building in ${subdir} ${redirect} ;;
  688.         esac
  689.  
  690.         # FIXME Should this be done recursively ??? (Useful for e.g. gdbtest)
  691.         # Set up the list of links to be made.
  692.         # ${links} is the list of link names, and ${files} is the list of names to link to.
  693.  
  694.         # Make the links.
  695.         configlinks="${links}"
  696.         if [ -r ${subdir}/config.status ] ; then
  697.                 mv -f ${subdir}/config.status ${subdir}/config.back
  698.         fi
  699.         while [ -n "${files}" ] ; do
  700.                 # set file to car of files, files to cdr of files
  701.                 set ${files}; file=$1; shift; files=$*
  702.                 set ${links}; link=$1; shift; links=$*
  703.  
  704.                 if [ ! -r ${srcdir}/${file} ] ; then
  705.                         echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2
  706.                         echo '***' "since the file \"${srcdir}/${file}\" does not exist." 1>&2
  707.                         exit 1
  708.                 fi
  709.  
  710.                 ${remove} -f ${link}
  711.         # Make a symlink if possible, otherwise try a hard link
  712.         if ${symbolic_link} ${srcdir}/${file} ${link} >/dev/null 2>&1 ; then
  713.             true
  714.         else
  715.             # We need to re-remove the file because Lynx leaves a 
  716.             # very strange directory there when it fails an NFS symlink.
  717.             ${remove} -r -f ${link}
  718.             ${hard_link} ${srcdir}/${file} ${link}
  719.         fi
  720.                 if [ ! -r ${link} ] ; then
  721.                         echo '***' "${progname}: unable to link \"${link}\" to \"${srcdir}/${file}\"." 1>&2
  722.                         exit 1
  723.                 fi
  724.  
  725.                 echo "Linked \"${link}\" to \"${srcdir}/${file}\"."
  726.         done
  727.  
  728.         # Create a .gdbinit file which runs the one in srcdir
  729.         # and tells GDB to look there for source files.
  730.  
  731.         if [ -r ${srcdir}/${subdir}/.gdbinit ] ; then
  732.                 case ${srcdir} in
  733.                 .) ;;
  734.                 *) cat > ${subdir}/.gdbinit <<EOF
  735. # ${NO_EDIT}
  736. dir ${makesrcdir}
  737. dir .
  738. source ${makesrcdir}/.gdbinit
  739. EOF
  740.                         ;;
  741.                 esac
  742.         fi
  743.  
  744.         # Install a makefile, and make it set VPATH
  745.         # if necessary so that the sources are found.
  746.         # Also change its value of srcdir.
  747.         # NOTE: Makefile generation constitutes the majority of the time in configure.  Hence, this section has
  748.         # been somewhat optimized and is perhaps a bit twisty.
  749.  
  750.         # code is order so as to try to sed the smallest input files we know.
  751.  
  752.         # the four makefile fragments MUST end up in the resulting Makefile in this order: 
  753.         # package, target, host, and site.  so do these separately because I don't trust the
  754.         #  order of sed -e expressions.
  755.  
  756.         if [ -f ${srcdir}/${subdir}/${Makefile_in} ] ; then
  757.  
  758.             # Conditionalize for this site from "Makefile.in" (or whatever it's called) into Makefile.tem
  759.             rm -f ${subdir}/Makefile.tem
  760.               case "${site}" in
  761.               "") cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem ;;
  762.               *)
  763.                       site_makefile_frag=${srcdir}/config/ms-${site}
  764.  
  765.                       if [ -f ${site_makefile_frag} ] ; then
  766.                               sed -e "/^####/  r ${site_makefile_frag}" ${srcdir}/${subdir}/${Makefile_in} \
  767.                                       > ${subdir}/Makefile.tem
  768.                       else
  769.                               cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem
  770.                               site_makefile_frag=
  771.                       fi
  772.                       ;;
  773.             esac
  774.             # working copy now in ${subdir}/Makefile.tem
  775.  
  776.             # Conditionalize the makefile for this host.
  777.             rm -f ${Makefile}
  778.             case "${host_makefile_frag}" in
  779.               "") mv ${subdir}/Makefile.tem ${Makefile} ;;
  780.               *)
  781.                       if [ ! -f ${host_makefile_frag} ] ; then
  782.                               host_makefile_frag=${srcdir}/${host_makefile_frag}
  783.                       fi
  784.                       if [ -f ${host_makefile_frag} ] ; then
  785.                               sed -e "/^####/  r ${host_makefile_frag}" ${subdir}/Makefile.tem > ${Makefile}
  786.                       else
  787.                               echo '***' Expected host makefile fragment \"${host_makefile_frag}\" 1>&2
  788.                               echo '***' is missing in ${PWD=`pwd`}. 1>&2
  789.                               mv ${subdir}/Makefile.tem ${Makefile}
  790.                       fi
  791.             esac
  792.             # working copy now in ${Makefile}
  793.  
  794.             # Conditionalize the makefile for this target.
  795.             rm -f ${subdir}/Makefile.tem
  796.             case "${target_makefile_frag}" in
  797.               "") mv ${Makefile} ${subdir}/Makefile.tem ;;
  798.               *)
  799.                       if [ ! -f ${target_makefile_frag} ] ; then
  800.                               target_makefile_frag=${srcdir}/${target_makefile_frag}
  801.                       fi
  802.                       if [ -f ${target_makefile_frag} ] ; then
  803.                               sed -e "/^####/  r ${target_makefile_frag}" ${Makefile} > ${subdir}/Makefile.tem
  804.                       else
  805.                               mv ${Makefile} ${subdir}/Makefile.tem
  806.                               target_makefile_frag=
  807.                       fi
  808.                       ;;
  809.             esac
  810.             # real copy now in ${subdir}/Makefile.tem
  811.  
  812.             # Conditionalize the makefile for this package.
  813.             rm -f ${Makefile}
  814.             case "${package_makefile_frag}" in
  815.               "") mv ${subdir}/Makefile.tem ${Makefile} ;;
  816.               *)
  817.                       if [ ! -f ${package_makefile_frag} ] ; then
  818.                               package_makefile_frag=${srcdir}/${package_makefile_frag}
  819.                       fi
  820.                       if [ -f ${package_makefile_frag} ] ; then
  821.                               sed -e "/^####/  r ${package_makefile_frag}" ${subdir}/Makefile.tem > ${Makefile}
  822.                   rm -f ${subdir}/Makefile.tem
  823.                       else
  824.                               echo '***' Expected package makefile fragment \"${package_makefile_frag}\" 1>&2
  825.                               echo '***' is missing in ${PWD=`pwd`}. 1>&2
  826.                               mv ${subdir}/Makefile.tem ${Makefile}
  827.                       fi
  828.             esac
  829.             # working copy now in ${Makefile}
  830.  
  831.             mv ${Makefile} ${subdir}/Makefile.tem
  832.  
  833.             # real copy now in ${subdir}/Makefile.tem
  834.  
  835.             # prepend warning about editting, and a bunch of variables.
  836.             rm -f ${Makefile}
  837.             cat > ${Makefile} <<EOF
  838. # ${NO_EDIT}
  839. VPATH = ${makesrcdir}
  840. links = ${configlinks}
  841. host_alias = ${host_alias}
  842. host_cpu = ${host_cpu}
  843. host_vendor = ${host_vendor}
  844. host_os = ${host_os}
  845. host_canonical = ${host_cpu}-${host_vendor}-${host_os}
  846. target_alias = ${target_alias}
  847. target_cpu = ${target_cpu}
  848. target_vendor = ${target_vendor}
  849. target_os = ${target_os}
  850. target_canonical = ${target_cpu}-${target_vendor}-${target_os}
  851. EOF
  852.         case "${build}" in
  853.           "") ;;
  854.           *)  cat >> ${Makefile} << EOF
  855. build_alias = ${build_alias}
  856. build_cpu = ${build_cpu}
  857. build_vendor = ${build_vendor}
  858. build_os = ${build_os}
  859. build_canonical = ${build_cpu}-${build_vendor}-${build_os}
  860. EOF
  861.         esac
  862.  
  863.             case "${package_makefile_frag}" in
  864.               "") ;;
  865.               /*) echo package_makefile_frag = ${package_makefile_frag} >>${Makefile} ;;
  866.               *)  echo package_makefile_frag = ${invsubdir}${package_makefile_frag} >>${Makefile} ;;
  867.             esac
  868.  
  869.             case "${target_makefile_frag}" in
  870.               "") ;;
  871.               /*) echo target_makefile_frag = ${target_makefile_frag} >>${Makefile} ;;
  872.               *)  echo target_makefile_frag = ${invsubdir}${target_makefile_frag} >>${Makefile} ;;
  873.             esac
  874.  
  875.             case "${host_makefile_frag}" in
  876.               "") ;;
  877.               /*) echo host_makefile_frag = ${host_makefile_frag} >>${Makefile} ;;
  878.               *)  echo host_makefile_frag = ${invsubdir}${host_makefile_frag} >>${Makefile} ;;
  879.             esac
  880.  
  881.             if [ "${site_makefile_frag}" != "" ] ; then
  882.                 echo site_makefile_frag = ${invsubdir}${site_makefile_frag} >>${Makefile}
  883.             fi 
  884.  
  885.         # make sure that some sort of reasonable default exists for these 
  886.         # two variables
  887.         CXX=${CXX-"g++ -O"}
  888.         CC=${CC-cc}
  889.  
  890.             # reset prefix, exec_prefix, srcdir, SUBDIRS, NONSUBDIRS,
  891.             # remove any form feeds.
  892.             if [ -z "${subdirs}" ]; then
  893.                 rm -f ${subdir}/Makefile.tem2
  894.                 sed -e "s:^SUBDIRS[     ]*=.*$:SUBDIRS = ${configdirs}:" \
  895.                     -e "s:^NONSUBDIRS[     ]*=.*$:NONSUBDIRS = ${noconfigdirs}:" \
  896.                     ${subdir}/Makefile.tem > ${subdir}/Makefile.tem2
  897.                 rm -f ${subdir}/Makefile.tem
  898.                 mv ${subdir}/Makefile.tem2 ${subdir}/Makefile.tem
  899.             fi
  900.             sed -e "s:^prefix[     ]*=.*$:prefix = ${prefix}:" \
  901.                     -e "s:^exec_prefix[     ]*=.*$:exec_prefix = ${exec_prefix}:" \
  902.             -e "s:^SHELL[     ]*=.*$:SHELL = ${config_shell}:" \
  903.                     -e "s:^srcdir[     ]*=.*$:srcdir = ${makesrcdir}:" \
  904.                     -e "s/ //" \
  905.                     -e "s:^program_prefix[     ]*=.*$:program_prefix = ${program_prefix}:" \
  906.                     -e "s:^program_suffix[     ]*=.*$:program_suffix = ${program_suffix}:" \
  907.                     -e "s:^program_transform_name[     ]*=.*$:program_transform_name = ${program_transform_name}:" \
  908.                     -e "s:^tooldir[     ]*=.*$:tooldir = ${tooldir}:" \
  909.                     ${subdir}/Makefile.tem >> ${Makefile}
  910.             # final copy now in ${Makefile}
  911.  
  912.         else
  913.            echo "No Makefile.in found in ${srcdir}/${subdir}, unable to configure" 1>&2
  914.         fi
  915.  
  916.         rm -f ${subdir}/Makefile.tem
  917.  
  918.         case "${host_makefile_frag}" in
  919.         "") using= ;;
  920.         *) using="and \"${host_makefile_frag}\"" ;;
  921.         esac
  922.  
  923.         case "${target_makefile_frag}" in
  924.         "") ;;
  925.         *) using="${using} and \"${target_makefile_frag}\"" ;;
  926.         esac
  927.  
  928.         case "${site_makefile_frag}" in
  929.         "") ;;
  930.         *) using="${using} and \"${site_makefile_frag}\"" ;;
  931.         esac
  932.  
  933.         newusing=`echo "${using}" | sed 's/and/using/'`
  934.         using=${newusing}
  935.         echo "Created \"${Makefile}\" in" ${PWD=`pwd`} ${using}
  936.  
  937.         . ${tmpfile}.pos
  938.  
  939.         # describe the chosen configuration in config.status.
  940.         # Make that file a shellscript which will reestablish
  941.         # the same configuration.  Used in Makefiles to rebuild
  942.         # Makefiles.
  943.  
  944.         case "${norecursion}" in
  945.         "") arguments="${arguments} --norecursion" ;;
  946.         *) ;;
  947.         esac
  948.  
  949.         if [ ${subdir} = . ] ; then
  950.             echo "#!/bin/sh
  951. # ${NO_EDIT}
  952. # This directory was configured as follows:
  953. ${progname}" ${arguments}  "
  954. # ${using}" > ${subdir}/config.new
  955.         else
  956.             echo "#!/bin/sh
  957. # ${NO_EDIT}
  958. # This directory was configured as follows:
  959. cd ${invsubdir}
  960. ${progname}" ${arguments}  "
  961. # ${using}" > ${subdir}/config.new
  962.         fi
  963.         chmod a+x ${subdir}/config.new
  964.         if [ -r ${subdir}/config.back ] ; then
  965.                 mv -f ${subdir}/config.back ${subdir}/config.status
  966.         fi
  967.         ${moveifchange} ${subdir}/config.new ${subdir}/config.status
  968.         ;;
  969.  
  970.     *)  rm -f ${Makefile} ${subdir}/config.status ${links} ;;
  971.     esac
  972. done
  973.  
  974. # If there are subdirectories, then recur. 
  975. if [ -z "${norecursion}" -a -n "${configdirs}" ] ; then 
  976.         for configdir in ${configdirs} ; do
  977.  
  978.                 if [ -d ${srcdir}/${configdir} ] ; then
  979.                         eval echo Configuring ${configdir}... ${redirect}
  980.                         case "${srcdir}" in
  981.                         ".") ;;
  982.                         *)
  983.                                 if [ ! -d ./${configdir} ] ; then
  984.                                         if mkdir ./${configdir} ; then
  985.                                                 true
  986.                                         else
  987.                                                 echo '***' "${progname}: could not make ${PWD=`pwd`}/${configdir}" 1>&2
  988.                                                 exit 1
  989.                                         fi
  990.                                 fi
  991.                                 ;;
  992.                         esac
  993.  
  994.                         POPDIR=${PWD=`pwd`}
  995.                         cd ${configdir} 
  996.  
  997. ### figure out what to do with srcdir
  998.                         case "${srcdir}" in
  999.                         ".") newsrcdir=${srcdir} ;; # no -srcdir option.  We're building in place.
  1000.                         /*) # absolute path
  1001.                                 newsrcdir=${srcdir}/${configdir}
  1002.                                 srcdiroption="--srcdir=${newsrcdir}"
  1003.                                 ;;
  1004.                         *) # otherwise relative
  1005.                                 newsrcdir=../${srcdir}/${configdir}
  1006.                                 srcdiroption="--srcdir=${newsrcdir}"
  1007.                                 ;;
  1008.                         esac
  1009.  
  1010.             # Handle --cache-file=../XXX
  1011.             case "${cache_file}" in
  1012.             "") # empty
  1013.                 ;;
  1014.             /*) # absolute path
  1015.                 cache_file_option="--cache-file=${cache_file}"
  1016.                 ;;
  1017.             *) # relative path
  1018.                 cache_file_option="--cache-file=../${cache_file}"
  1019.                 ;;
  1020.             esac
  1021.  
  1022. ### check for guested configure, otherwise fix possibly relative progname
  1023.                         if [ -f ${newsrcdir}/configure ] ; then
  1024.                                 recprog=${newsrcdir}/configure
  1025.                         elif [ -f ${newsrcdir}/configure.in ] ; then
  1026.                                 case "${progname}" in
  1027.                                 /*)     recprog=${progname} ;;
  1028.                                 *)      recprog=../${progname} ;;
  1029.                                 esac
  1030.             else
  1031.                 eval echo No configuration information in ${configdir} ${redirect}
  1032.                 recprog=
  1033.                         fi
  1034.  
  1035. ### The recursion line is here.
  1036.             if [ ! -z "${recprog}" ] ; then
  1037.                             if eval ${config_shell} ${recprog} ${verbose} ${buildopt} --host=${host_alias} --target=${target_alias} \
  1038.                                     ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
  1039.                                     ${srcdiroption} ${program_prefixoption} ${program_suffixoption} ${program_transform_nameoption} ${site_option} ${withoptions} ${withoutoptions} ${enableoptions} ${disableoptions} ${cache_file_option} ${removing} ${other_options} ${redirect} ; then
  1040.                                     true
  1041.                             else
  1042.                     echo Configure in `pwd` failed, exiting. 1>&2
  1043.                                     exit 1
  1044.                             fi
  1045.             fi
  1046.  
  1047.                         cd ${POPDIR}
  1048.                 fi
  1049.         done
  1050. fi
  1051.  
  1052. # Perform the same cleanup as the trap handler, minus the "exit 1" of course,
  1053. # and reset the trap handler.
  1054. rm -f ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos
  1055. trap 0
  1056.  
  1057. exit 0
  1058.  
  1059. #
  1060. # Local Variables:
  1061. # fill-column: 131
  1062. # End:
  1063. #
  1064.  
  1065. # end of configure
  1066.